From b79f2cb7c70d7c311162cb9d38b3921b76ddae3d Mon Sep 17 00:00:00 2001
From: Andrew Clemons <andrew.clemons@gmail.com>
Date: Thu, 5 May 2016 12:55:02 +1200
Subject: [PATCH] Use TLS1.1 and TLS1.2 if openssl supports it

---
 src/gssl/gssl_openssl.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gssl/gssl_openssl.cpp b/src/gssl/gssl_openssl.cpp
index 34af44f..f64ad94 100644
--- a/src/gssl/gssl_openssl.cpp
+++ b/src/gssl/gssl_openssl.cpp
@@ -294,8 +294,10 @@ GSsl::Context::Context( const std::string & pem_file , unsigned int flags )
 		m_ssl_ctx = SSL_CTX_new(SSLv23_method()) ;
 	else if( (flags&3U) == 3U )
 		m_ssl_ctx = SSL_CTX_new(SSLv3_method()) ;
-	else
-		m_ssl_ctx = SSL_CTX_new(TLSv1_method()) ;
+	else {
+		m_ssl_ctx = SSL_CTX_new(SSLv23_method()) ;
+		SSL_CTX_set_options(m_ssl_ctx, SSL_OP_NO_SSLv2| SSL_OP_NO_SSLv3) ;
+	}
 
 	if( m_ssl_ctx == NULL )
 		throw Error( "SSL_CTX_new" , ERR_get_error() ) ;
